Conversation
|
I will checkout your branch and give it a shot now |
|
Please feel free to push directly. I'll leave it alone for now. |
|
Could you give a bit of explanation of why we would want this and what problems |
Cause is that Extern is recursive, |
|
Ah, yes, sorry for not raising an issue to discuss this first. @oxinabox and I spent the day thinking about this and related issues yesterday and thought it would be a good idea to remove
Could you elaborate a bit on this please? When does having a |
One isn't actually a valid differential in general. Part of my little differential types manifesto: There are 3 kinds of things;
Primal Types exist, they have very few requirements on them. Differential types exist, and they corespond to being valid for one or more Primal Type. I thought this was enough at first, but it isn't.
Now, right now (without this PR)
Seperate to this we may want to reintroduce There are some other rules too, I should write this out in a docs PR, (*Note: Wirtinger is not a differential under this defintion, but it is some generalization, where potentially some sum of wirtingers will be a differential again) |
|
I've opened #62 to discuss things related to this. It's a bit broader than this particular issue, but would be a good place to discuss it regardless. |
One example would be the push_forward for matrix multiplication. We define: If we now wanted to find the jacobian of the function Regarding @oxinabox's point: Why not just define |
Good point, I did not realize that was true. (It still wouldn't be a valid differential with #59 |
45e3095 to
10342f3
Compare
|
@simeonschaub I'm not sure that I entirely follow your example. The function frule(::typeof(*), A, B)
return A * B, (_, dA, dB) -> dA * B + A * dB
endYour proposed function is v -> M * vwhere M dvfor some vector-valued perturbation So to me it seems that the example you propose conflates individual differentials with a representation of a collection of differentials, which isn't something that we really have any notion of in ChainRules at the minute. Were we to consider the single-seed setting, a 1-hot vector of some kind would be the appropriate thing. |
fix extra comma
Fix test as per Lyndon's suggestion Co-Authored-By: Lyndon White <oxinabox@ucc.asn.au> fix type fix left over one
10342f3 to
bd014f4
Compare
|
@willtebbutt I am done with messing with it, so you can touch it again freely. |
|
@simeonschaub regarding my above comment -- I am very pro- formalising this interface, as I imagine that @ChrisRackauckas need this for |
|
bump :) is there still a decision to be made between this and #60 ? |
Yes. still needs to be decided. I still don't think If it actually gives better performance than After JuliaDiff/ChainRules.jl#133 |
|
What still worries me about replacing julia> a = [1 2; 3 4]
2×2 Array{Int64,2}:
1 2
3 4
julia> b = I*a
2×2 Array{Int64,2}:
1 2
3 4
julia> a === b
falseso multiplication with |
|
My question is still why we want / need a Taking the vector space view of differentials, I can definitely get behind wanting a multiplicative identity for our scalars (most of the time?), but there's no special status for the vector While I agree that for |
Note this also applies to It does not apply to |
|
ForwardDiff2.jl doesn't use |
| export extern, store! | ||
| export Wirtinger, Zero, One, DoesNotExist, Thunk, InplaceableThunk | ||
| export unthunk | ||
| export Wirtinger, Zero, DoesNotExist, Thunk, InplaceableThunk |
There was a problem hiding this comment.
| export Wirtinger, Zero, DoesNotExist, Thunk, InplaceableThunk | |
| export DoesNotExist, InplaceableThunk, Thunk, unthunk, Wirtinger, Zero |
| function Wirtinger(primal::Union{Number,AbstractDifferential}, | ||
| conjugate::Union{Number,AbstractDifferential}) | ||
| function Wirtinger( | ||
| primal::Union{Number,AbstractDifferential}, |
There was a problem hiding this comment.
| primal::Union{Number,AbstractDifferential}, | |
| primal::Union{Number, AbstractDifferential}, |
| conjugate::Union{Number,AbstractDifferential}) | ||
| function Wirtinger( | ||
| primal::Union{Number,AbstractDifferential}, | ||
| conjugate::Union{Number,AbstractDifferential}, |
There was a problem hiding this comment.
| conjugate::Union{Number,AbstractDifferential}, | |
| conjugate::Union{Number, AbstractDifferential}, |
| (x::Thunk)() = x.f() | ||
| @inline extern(x::Thunk) = extern(x()) | ||
| @inline unthunk(x::Thunk) = x() | ||
|
|
| @test rr1 == 1 | ||
| end | ||
| @testset "rules" begin | ||
|
|
|
Closing as this is horribly outdated. #62 is still open, so hopefully we'll get around to removing |
What it says on the tin. Currently getting a load of errors because I'm trying to
externaWirtingersomewhere. @oxinabox could do with your assistance here. Any idea what's going on? Is our overly-aggressive externing causing problems maybe?edit: the surprisingly large number of changed line is due to sorting out some formatting issues.